home *** CD-ROM | disk | FTP | other *** search
- #include "drawwin.h"
- #include "bitmap.h"
- #include "gadgets.h"
- #include "menu.h"
- #include "screen.h"
-
- #include<graphics/rastport.h>
-
- #include<stdio.h>
-
- #include<clib/graphics_protos.h>
- #include<clib/intuition_protos.h>
-
- /* Global record of our tool window */
- struct Window* drawwin = NULL;
-
- int openDrawWin()
- {
- struct Screen* scr = getScreen();
- setModified(FALSE);
- /* Open our drawing window */
- if(drawwin = OpenWindowTags(NULL,
- WA_Left, 0,
- WA_Top, 0,
- /* Make the window the same size as the screen */
- WA_Width, scr->Width,
- WA_Height, scr->Height,
- WA_Flags, WFLG_BACKDROP | WFLG_BORDERLESS | WFLG_REPORTMOUSE | WFLG_SUPER_BITMAP,
- WA_IDCMP, IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_MENUPICK,
- WA_CustomScreen, scr,
- WA_SuperBitMap, getBitmap(),
- TAG_DONE, 0))
- {
- /* Clear our window, since our new bitmap may not be cleared already */
- SetRast(drawwin->RPort, 0);
- /* Set the drawing mode to draw only the foreground of text, not the background */
- SetDrMd(drawwin->RPort, JAM1);
- resetFgPen(drawwin);
- /* Attach menu strip to drawing window */
- if(SetMenuStrip(drawwin, getMenuStrip()))
- return TRUE;
- else
- printf("Error: could not attach menus to drawing window\n");
- }
- else
- printf("Error: could not open drawing window\n");
- return FALSE;
- }
-
- void closeDrawWin()
- {
- if(drawwin)
- {
- ClearMenuStrip(drawwin);
- CloseWindow(drawwin);
- drawwin = NULL;
- }
- }
-
- struct Window* getDrawWin()
- {
- return drawwin;
- }
-
- /* Record of whether the image has changed */
- static int modified = FALSE;
-
- int isModified()
- {
- return modified;
- }
-
- void setModified(int mod)
- {
- modified = mod;
- }
-
-